package com.gjintel.test;

import java.io.FileInputStream;

import org.activiti.engine.IdentityService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.test.ActivitiRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;


@RunWith(SpringJUnit4ClassRunner.class)  
@ContextConfiguration(value = "classpath*:applicationContext.xml") 
public class DeployWorkflow {

	private String filename = "D:\\eclipse_workspace\\e_trade\\src\\resources\\Process1.bpmn";

	@Rule
	public ActivitiRule activitiRule = new ActivitiRule();
	
	@Autowired
	private TaskService taskService;
	@Autowired
	private RepositoryService repositoryService;
	@Autowired
	private RuntimeService runtimeService;
	@Autowired
	private IdentityService identityService;
	
	private String processDefinitionKey="tender";
	
	@Test
	public void testDeploy() throws Exception{
		repositoryService.createDeployment().addInputStream("Process1.bpmn", new FileInputStream(filename)).deploy();
		System.out.println("deploy process1.bpmn:");
	}
	
	
}
